/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package network;

import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author tandaica0612
 */
public class GetResponseHeaderOfWebSite {

    public GetResponseHeaderOfWebSite() {
        try {
            URL url = new URL("http://www.exampledepot.com/egs/java.net/GetHeaders.html");
            URLConnection conn = url.openConnection();
            for(int i=0;i<conn.getHeaderFields().size();i++){
                System.out.print("Key : "+ conn.getHeaderFieldKey(i) + "Value : "+ conn.getHeaderField(i) + "\n");
            }
        } catch (IOException ex) {
            Logger.getLogger(GetResponseHeaderOfWebSite.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    /*
    public static void main(String args[]){
        new GetResponseHeaderOfWebSite();
    }
     * */
}
